<template>
	<div class="content">
		<div class="base" style="margin-bottom: 12px;">
			<Form inline class="fl">
				<Input type="text" placeholder="请输入个人UUID" class="w200 m-r10" v-model="userID" />
				<Input type="text" placeholder="请输入手机号码" class="w200 m-r10" v-model="trueName" />
				<!--<Input type="text" placeholder="请输入手机号码" class="w200 m-r10" v-model="phone" />-->
				<!--<Select placeholder="请选等级" class="w200 m-r10" v-model="state2">
					<Option value="0">全部</Option>
					<Option value="1">普通会员</Option>
					<Option value="2">VIP会员</Option>
					<Option value="3">超级节点</Option>
				</Select>-->
				<DatePicker type="daterange" split-panels placeholder="请选择时间" class="w200 m-r10" format="yyyy-MM-dd" @on-change="getTime"></DatePicker>
				<Button type="primary" @click="query">查询</Button>
			</Form>
		</div>
		<Button class="daochu" type="primary" size="large" @click="exportData" :loading="dcShow">
      <Icon type="ios-download-outline"></Icon>导出
    </Button>
		<Table stripe :columns="columns1" :data="list" ref="table" :loading="loading"></Table>
		<!--<Table stripe :columns="columns1" :data="downList" ref="table2" v-show="false"></Table>-->

		<Page :total="info" show-elevator :page-size="pageSize" show-total @on-change="changepage" :current.sync="current"></Page>

		<Modal v-model="modal2" title="Ta的节点" width="50%">
			<Form :label-width="100">
				<div class="base p-b10 bor-b">
					<Form inline class="fl">
						<Input type="text" placeholder="请输入个人UUID" class="w200 m-r10" v-model="upUserID" />
						<Input type="text" placeholder="请输入用户名" class="w200 m-r10" v-model="upPhone" />
						<!--<Select placeholder="请选等级" class="w200 m-r10" v-model="state2">
							<Option value="0">全部</Option>
							<Option value="1">普通用户</Option>
							<Option value="2">一星</Option>
							<Option value="3">二星</Option>
							<Option value="2">三星</Option>
							<Option value="3">四星</Option>
							<Option value="2">社区节点</Option>
							<Option value="3">超级节点</Option>
						</Select>-->
						<DatePicker type="daterange" split-panels placeholder="请选择注册时间" class="w200 m-r10" format="yyyy-MM-dd" @on-change="getTime1" v-model="dataPicker"></DatePicker>
						<Button type="primary" @click="jidian">查询</Button>
					</Form>
				</div>
				<Table height="400" class="m-t10" stripe :columns="columns2" :data="jdList" :loading="loading2"></Table>
				<Page :total="info2" show-elevator :page-size="pageSize2" show-total @on-change="changepage2" :current.sync="current2" ref="page2"></Page>
			</Form>
		</Modal>

		<Modal v-model="modal3" title="Ta的上级" width="50%">
			<Table height="400" class="m-t10" stripe :columns="columns9" :data="myUpList"></Table>
		</Modal>

		<Modal v-model="modal6" title="团队人数" width="50%" @on-cancel="teamList = [];">
			<Table height="400" class="m-t10" stripe :columns="columns10" :data="teamList" :loading="teamLoading"></Table>
			<Page :total="info8" show-elevator :page-size="pageSize2" show-total @on-change="teamPageChange" :current.sync="current4" ref="page8"></Page>
		</Modal>

		<Modal v-model="modal4" title="账户流水" width="40%">
			<fieldset style="margin-bottom: 10px;">
				<legend>账户信息</legend>
				<div>
					<table>
						<tbody>
							<tr>
                <td class="padding">
									USDT账户(可用)：
									<span class="blue" v-text="flow.usdt ? Fixed(Number(flow.usdt.availableNum),4) : '0.0000'"></span>
								</td>
								<td class="padding">
									钱包账户(可用)：
									<span class="blue" v-text="flow.estate ? Fixed(Number(flow.estate.availableNum),4) : '0.0000'"></span>
								</td>						
								<td class="padding">
									第一期专用账户(锁仓)：
									<span class="blue" v-text="flow.one ? Fixed(Number(flow.one.freezeNum),4) : '0.0000'"></span>
								</td>
								<td class="padding">
									第二期专用账户(锁仓)：
									<span class="blue" v-text="flow.two ? Fixed(Number(flow.two.freezeNum),4) : '0.0000'"></span>
								</td>
								<td class="padding">
									第三期专用账户(锁仓)：
									<span class="blue" v-text="flow.three ? Fixed(Number(flow.three.freezeNum),4) : '0.0000'"></span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Tabs type="card" class="m-t10" v-model="tabsKey" @on-click="liushui(tabsKey,1)">
				<TabPane label="USDT账户" name="1">
					<Table height="400" stripe :columns="columns3" :data="contributions" :loading="loading3"></Table>
					<Page :total="info3" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current3" ref="page3"></Page>
				</TabPane>
				<TabPane label="钱包账户" name="2">
					<Table height="400" stripe :columns="columns3" :data="contributions2" :loading="loading4"></Table>
					<Page :total="info4" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current4" ref="page4"></Page>
				</TabPane>
				<TabPane label="第一期专用账户" name="3">
					<Table height="400" stripe :columns="columns3" :data="first_details" :loading="first_load"></Table>
					<Page :total="infofirst" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current4" ref="pagefirst"></Page>
				</TabPane>
				<TabPane label="第二期专用账户" name="4">
					<Table height="400" stripe :columns="columns3" :data="second_details" :loading="second_load"></Table>
					<Page :total="infosecond" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current4" ref="pagesecond"></Page>
				</TabPane>
				<TabPane label="第三期专用账户" name="5">
					<Table height="400" stripe :columns="columns3" :data="third_details" :loading="third_load"></Table>
					<Page :total="infothird" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current4" ref="pagethird"></Page>
				</TabPane>
			</Tabs>
		</Modal>
		<Modal v-model="modal1" title="用户充值" width="40%" :mask-closable="false">
			<Form :label-width="100" :model="addForm" :rules="rules" ref="refuse">
				<FormItem label="充值用户UUID" prop="title">
					<Input class="w-50" v-model="addForm.userId" placeholder="请输入充值会员ID" :disabled="true" />
				</FormItem>
				<FormItem label="充值用户账号" prop="title">
					<Input class="w-50" v-model="addForm.userName" placeholder="#" :disabled="true" />
				</FormItem>
				<FormItem label="充值账户">
					<i-select class="w-50" v-model="addForm.accountType">
						<i-option :value="item.id" v-for="(item,index) in recharge_data" :key="index">{{item.name}}</i-option>
					</i-select>
				</FormItem>
				<FormItem label="充值数量" prop="userNum">
					<Input class="w-50" v-model="addForm.userNum" placeholder="请输入充值数量(负数为扣除)" />
				</FormItem>
				<FormItem label="备注" prop="userRem">
					<Input class="w-50" v-model="addForm.userRem" placeholder="请输入备注" />
				</FormItem>
				<FormItem label="充值密码" prop="password">
					<Input class="w-50" v-model="addForm.password" placeholder="请输入充值密码" type="password" />
				</FormItem>
				<FormItem label prop="hint">
					<span class="red m-l10">*请认真检查充值会员信息和充值数量</span>
				</FormItem>
			</Form>
			<div slot="footer">
				<Button type="text" size="large" @click="closejj">取消</Button>
				<Button type="primary" size="large" @click="addjj">确定</Button>
			</div>
		</Modal>
		<Modal v-model="complaintModal" title="被投诉记录" width="70%">
			<fieldset style="margin-bottom: 10px;">
				<legend>账户信息</legend>
				<div>
					<table>
						<tbody>
							<tr>
								<td class="padding">
									累计投诉次数：
									<span class="blue" v-text="complaintCount">0</span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Table height="400" stripe :columns="complaintColumns" :data="complaintList" ref="table7" :loading="loading5"></Table>
			<Page :total="info7" show-elevator :page-size="pageSize2" show-total @on-change="complaintPageChange" :current.sync="current4" ref="page7"></Page>
		</Modal>
		<Modal v-model="mnemonicModal" title="助记词">
			<div style="display: flex;flex-wrap: wrap;">
				<div v-for="(item,index) of mnemonicList" :key="index" style="width: 33%;text-align: center;line-height: 30px;">
					<span v-text="item"></span>
				</div>
			</div>
		</Modal>
	</div>
</template>
<script>
	import moment from "moment";
	let _this;
	export default {
		data() {
			return {
				recharge_data: [],
				dataPicker: "",
				loading: true,
				loading2: true,
				loading3: true,
				loading4: true,
				loading5: true,
				first_load: true,
				second_load: true,
				third_load: true,
				teamLoading: true,
				lsType: 1, // 流水的type
				dcShow: false,
				jsonData: [],
				complaintList: [], // 投诉记录列表
				modal1: false,
				lsId: "", // 账户流水Id
				tabsKey: "1",
				upPhone: "",
				addForm: {
					userId: "",
					userName: "",
					userNum: "",
					userRem: "",
					id: "",
					password: "",
					accountType: ""
				},
				flow: {
					exuu: {
						availableNum: "",
						freezeNum: ""
					},
					usdt: {
						availableNum: "",
						freezeNum: ""
					}
				},
				rules: {
					userNum: [{
							required: true,
							message: "充值数量不能为空",
							trigger: "blur"
						},
						{
							type: "string",
							pattern: /^(-|\+)?(([1-9]\d{0,9})|0)(\.\d{0,9})?$/,
							message: "请输入合法的充值数量",
							trigger: "blur"
						}
					],
					userRem: [{
						required: true,
						message: "备注不能为空",
						trigger: "blur"
					}],
					password: [{
						required: true,
						message: "充值密码不能为空",
						trigger: "blur"
					}]
				},
				state: "", // 状态
				state2: "", // 状态
				state3: "",
				model: false,
				loading: true,
				modelIndex: "",
				userID: "",
				trueName: "",
				list: [], // 会员列表
				downList: [],
				zcList: [], // 资产列表
				jdList: [], // 节点列表
				myUpList: [], // 上级的信息
				teamList: [], // 团队人数
				mnemonicList: [], // 助记词
				liushuiSum: {
					gold: "",
					mine1: "",
					mine2: "",
					mine3: ""
				},
				contributions: [],
				contributions2: [],
				contributions3: [],
				contributions4: [],
				first_details: [],
				second_details: [],
				third_details: [],
				consumeMINE: [], // 消费明细
				exchangeMINE: [], // 兑换明细
				gold: [], // GOLD明细
				releasedMINE: [], // 待释放明细
				huiyId: "",
				info: null, // 总条数
				info2: null, // 总条数
				info3: null, // 总条数
				info4: null, // 总条数
				info7: null, // 总条数
				info8: null, // 总条数
				infofirst: null, // 总条数
				infosecond: null, // 总条数
				infothird: null, // 总条数
				pageSize: 20, // 一页显示多少条
				pageSize2: 10, // 一页显示多少条
				page: 1, // 页数
				page2: 1, // 页数
				page3: 1, // 页数
				page4: 1, // 页数
				page7: 1, // 页数
				page8: 1, // 页数
				pagefirst: 1, // 页数
				pagesecond: 1, // 页数
				pagethird: 1, // 页数
				current: 1,
				current2: 1,
				current3: 1,
				current4: 1,
				current7: 1,
				current8: 1,
				DownloadList: [], // 导出table
				upUserID: "",
				paiid: "",
				dataValue: ["", ""], // 时间段值 会员列表
				dataValue1: ["", ""], // 时间段值  节点
				phone: "",
				modal2: false,
				modal3: false,
				modal4: false,
				modal5: false,
				modal6: false,
				complaintModal: false,
				mnemonicModal: false,
				teamById: "",
				layer: "",
				complaintId: "",
				complaintCount: "",
				columns1: [{
						title: "个人UUID",
						key: "uuid",
						align: "center",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.getUuid(params.row.id);
										}
									}
								},
								params.row.uuid
							);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "助记词",
						align: "center",
						key: "auxiliaries",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.mnemonicList = params.row.auxiliaries.split(" ");
											this.mnemonicModal = true;
										}
									}
								},
								"查看详情"
							);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h(
								"div",
								'VIP'
							);
						}
					},
					{
						title: "USDT账户（持有量）",
						align: "center",
						key: "usdtBalance",
						render: (h, params) => {
							return h(
								"div",
								params.row.usdtBalance == null ?
								"0.00" :
								this.Fixed(params.row.usdtBalance, 4)
							);
						}
					},
					{
						title: "钱包账户（持有量）",
						align: "center",
						key: "walletBalance",
						render: (h, params) => {
							return h(
								"div",
								params.row.walletBalance == null ?
								"0.00" :
								this.Fixed(params.row.walletBalance, 4)
							);
						}
					},
					{
						title: "第一期账户",
						align: "center",
						key: "oneBalance",
						render: (h, params) => {
							return h(
								"div",
								params.row.oneBalance == null ?
								"0.00" :
								this.Fixed(params.row.oneBalance, 4)
							);
						}
					},
					{
						title: "第二期账户",
						align: "center",
						key: "twoBalance",
						render: (h, params) => {
							return h(
								"div",
								params.row.twoBalance == null ?
								"0.00" :
								this.Fixed(params.row.twoBalance, 4)
							);
						}
					},
					{
						title: "第三期账户",
						align: "center",
						key: "threeBalance",
						render: (h, params) => {
							return h(
								"div",
								params.row.threeBalance == null ?
								"0.00" :
								this.Fixed(params.row.threeBalance, 4)
							);
						}
					},
					{
						title: "Ta的节点",
						align: "center",
						key: "nodesNum",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.zhitui(params.row.id);
											this.upUserID = "";
											this.upPhone = "";
											this.state3 = "";
											this.dataPicker = "";
										}
									}
								},
								params.row.nodesNum
							);
						}
					},
					{
						title: "团队人数",
						align: "center",
						key: "number",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.page8 = 1;
											this.current8 = 1;
											this.teamLoading = true;
											this.modal6 = true;
											this.teamById = params.row.id;
											this.axios
												.post(
													"/admin/account/member/getTeamList",
													this.qs.stringify({
														id: this.teamById,
														size: this.pageSize2,
														current: this.page8
													})
												)
												.then(res => {
													if(res.data.code == 200) {
														this.teamLoading = false;
														this.teamList = res.data.data.records;
														this.layer = params.row.layer;
														this.teamList.teamLayer =
															this.teamList.layer - params.row.layer;
														this.teamList.forEach((row, i) => {
															this.teamList[i].teamLayer =
																row.layer - params.row.layer;
														});
														this.info8 = res.data.data.total;
													}
												});
										}
									}
								},
								params.row.number == null ? "0" : params.row.number
							);
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						width: 150,
						sortable: true,
						render: (h, params) => {
							return h(
								"div",
								params.row.createTime == null ?
								"#" :
								this.stringToTime(params.row.createTime)
							);
						}
					},
					{
						title: "账号状态",
						align: "center",
						key: "status",
						render: (h, params) => {
							return h("div", [
								h(
									"Button", {
										props: {
											type: params.row.status == "冻结" ? "error" : "primary",
											size: "small"
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.userStatus(
													params.row.id,
													params.row.status == "冻结" ? 2 : 1
												);
											}
										}
									},
									params.row.status
								)
							]);
						}
					},
					{
						title: "操作",
						key: "action",
						width: 260,
						fixed: "right",
						align: "center",
						render: (h, params) => {
							return h("div", [
								h(
									"Button", {
										props: {
											type: "primary",
											size: "small",
											disabled: params.row.status != "冻结"
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.Recharge(
													params.row.uuid,
													params.row.id,
													params.row.userName
												);
												this.getAccoountType();
											}
										}
									},
									"充值"
								),
								h(
									"Button", {
										props: {
											type: "primary",
											size: "small"
											//											disabled: !(localStorage.Flow == false)
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.lsId = params.row.id;
												this.tabsKey = "1";
												this.liushui(1, 1);
											}
										}
									},
									"账户流水"
								)
								// h(
								// 	"Button", {
								// 		props: {
								// 			type: "primary",
								// 			size: "small",
								// 			disabled: params.row.levelId != 1
								// 		},
								// 		style: {
								// 			marginRight: "5px"
								// 		},
								// 		on: {
								// 			click: () => {
								// 				let $this = this;
								// 				this.$Modal.confirm({
								// 					title: "升级超级会员",
								// 					content: "是否要升级该用户为超级会员？",
								// 					onOk: function() {
								// 						$this.axios.get('/admin/account/member/upgrade/' + params.row.id).then(res => {
								// 							if(res.data.code == 200) {
								// 								$this.getList();
								// 								$this.$Message.info(res.data.msg);
								// 							}
								// 						})
								// 					}
								// 				});
								// 			}
								// 		}
								// 	},
								// 	"升级超级节点"
								// ),
							]);
						}
					}
				],
				columns2: [{
						title: "个人UUID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h(
								"div",
								params.row.levelId == null ?
								"#" :
									params.row.levelId == null ?
								"#" :
								'VIP'
							);
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h(
								"div",
								params.row.createTime == null ?
								"#" :
								this.stringToTime(params.row.createTime)
							);
						}
					}
				],
				// 账户流水列表字段
				columns3: [{
						title: "时间",
						align: "center",
						key: "dateTime",
						sortable: true,
						render: (h, params) => {
							return h(
								"div",
								params.row.dateTime == null ?
								"#" :
								this.stringToTime(params.row.dateTime)
							);
						}
					},
					{
						title: "数量",
						align: "center",
						key: "num",
						render: (h, params) => {
							return h("div", params.row.num == null ? "#" : params.row.num);
						}
					},
					{
						title: "类型",
						align: "center",
						key: "type",
						render: (h, params) => {
							return h("div", params.row.type == null ? "#" : params.row.type);
						}
					}
				],
				// Ta的上级列表字段
				columns9: [{
						title: "个人UUID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h(
								"div",
								params.row.levelId == null ?
								"#" :
								'VIP'
							);
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h(
								"div",
								params.row.createTime == null ?
								"#" :
								this.stringToTime(params.row.createTime)
							);
						}
					}
				],
				// 团队人数字段
				columns10: [{
						title: "个人UUID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h(
								"div",
								params.row.levelId == null ?
								"#" :
								'VIP'
							);
						}
					},
					{
						title: "代数",
						align: "center",
						key: "teamLayer",
						render: (h, params) => {
							return h(
								"div",
								params.row.teamLayer == null ? "#" : params.row.teamLayer
							);
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h(
								"div",
								params.row.createTime == null ?
								"#" :
								this.stringToTime(params.row.createTime)
							);
						}
					}
				],
				complaintColumns: [{
						title: "申诉方",
						key: "createMemberId",
						render: (h, params) => {
							return h(
								"div",
								params.row.createMemberId == null ?
								"#" :
								params.row.createMemberId == params.row.memberId ?
								"用户" :
								"商户"
							);
						}
					},
					{
						title: "商户名",
						key: "otcUserName",
						render: (h, params) => {
							return h(
								"div",
								params.row.otcUserName == null ? "#" : params.row.otcUserName
							);
						}
					},
					{
						title: "用户名",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "凭证",
						key: "credentials",
						render: (h, params) => {
							return h("div", [
								h("img", {
									attrs: {
										src: params.row.credentials,
										preview: "1"
									},
									style: {
										width: "70px",
										height: "70px",
										margin: "10px 0"
									}
								})
							]);
						}
					},
					{
						title: "申诉备注",
						key: "appealRemark",
						render: (h, params) => {
							return h(
								"div",
								params.row.appealRemark == null ? "#" : params.row.appealRemark
							);
						}
					},
					{
						title: "处理结果备注",
						key: "resultsRemark",
						render: (h, params) => {
							return h(
								"div",
								params.row.resultsRemark == null ? "#" : params.row.resultsRemark
							);
						}
					},
					{
						title: "处理结果",
						key: "processingResults",
						render: (h, params) => {
							return h(
								"div",
								params.row.processingResults == null ?
								"#" :
								params.row.processingResults == 0 ?
								"未处理" :
								"已处理"
							);
						}
					}
				]
			};
		},
		beforeCreate() {
			_this = this;
		},
		methods: {
			getAccoountType() {
				this.axios
					.get("/admin/account/member/getAccoountType")
					.then(res => {
						if(res.data.code == 200) {
							this.recharge_data = res.data.data;
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
						}
					});
			},
			getUuid(id) {
				// 点击用户,查询上级的信息
				this.myUpList = [];
				this.modal3 = true;
				this.axios
					.get("/admin/account/member/getSuperior", {
						params: {
							userId: id
						}
					})
					.then(res => {
						if(res.data.code == 200) {
							this.myUpList = res.data.data;
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
						}
					});
			},
			// 节点
			zhitui(id) {
				this.modal2 = true;
				this.$refs["page2"].currentPage = 1;
				this.paiid = id;
				this.axios
					.post(
						"/admin/account/member/getChildNodes",
						this.qs.stringify({
							current: 1,
							size: this.pageSize2,
							id: id
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.jdList = res.data.data.records;
							this.info2 = res.data.data.total;
							this.loading2 = false;
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
						}
					});
			},
			jidian() {
				this.axios
					.post(
						"/admin/account/member/getChildNodes",
						this.qs.stringify({
							current: this.page2,
							size: this.pageSize2,
							startTime: this.dataValue1[0] == "" ? "" : this.dataValue1[0] + " 00:00:00",
							endTime: this.dataValue1[1] == "" ? "" : this.dataValue1[1] + " 23:59:59",
							id: this.paiid,
							uuid: this.upUserID,
							phone: this.upPhone,
							levelId: this.state3
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.jdList = res.data.data.records;
							this.info2 = res.data.data.total;
							this.loading2 = false;
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
							this.jdList = [];
						}
					});
			},
			// 查看流水
			liushui(type, current) {
				this.modal4 = true;
				this.getUser(type, current);
				this.$refs["page3"].currentPage = 1;
				this.$refs["page4"].currentPage = 1;
				this.$refs["pagefirst"].currentPage = 1;
				this.$refs["pagesecond"].currentPage = 1;
				this.$refs["pagethird"].currentPage = 1;
			},
			// 获取账户流水
			getUser(type, current) {
				this.loading3 = true;
				this.loading4 = true;
				type = Number(type);
				this.lsType = type;
				this.axios
					.post(
						"/admin/account/member/statistical/getAccountDetail",
						this.qs.stringify({
							id: this.lsId,
							size: this.pageSize2,
							current: current,
							paymentType: type // 1钱包 2 USDT 3 第一期 4第二期 5第三期
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.flow = res.data.data;
							switch(type) {
								case 1:
									this.contributions = res.data.data.list.records;
									this.info3 = res.data.data.list.total;
									this.loading3 = false;
									break;
								case 2:
									this.contributions2 = res.data.data.list.records;
									this.info4 = res.data.data.list.total;
									this.loading4 = false;
									break;
								case 3:
									this.first_details = res.data.data.list.records;
									this.infofirst = res.data.data.list.total;
									this.first_load = false;
									break;
								case 4:
									this.second_details = res.data.data.list.records;
									this.infosecond = res.data.data.list.total;
									this.second_load = false;
									break;
								case 5:
									this.third_details = res.data.data.list.records;
									this.infothird = res.data.data.list.total;
									this.third_load = false;
									break;
							}
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
						}
					});
			},
			// 导出
			exportData() {
				let params = this.qs.stringify({
					current: this.page,
					size: this.pageSize
				});
				this.jsonData = [];
				this.dcShow = true;
				this.axios
					.post(
						"/admin/account/member/getAllUser",
						this.qs.stringify({
							current: this.page,
							size: this.pageSize,
							uuid: this.userID,
							phone: this.trueName,
							status: this.state2 == 0 ? "" : this.state2,
							levelId: this.state,
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + " 00:00:00",
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + " 23:59:59"
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.axios
								.post(
									"/admin/account/member/getAllUser",
									this.qs.stringify({
										current: this.page,
										size: res.data.data.total,
										uuid: this.userID,
										phone: this.trueName,
										status: this.state2 == 0 ? "" : this.state2,
										levelId: this.state,
										startTime: this.dataValue[0] == "" ?
											"" :
											this.dataValue[0] + " 00:00:00",
										endTime: this.dataValue[1] == "" ?
											"" :
											this.dataValue[1] + " 23:59:59"
									})
								)
								.then(res => {
									if(res.data.code == 200) {
										this.downList = res.data.data.records;
										this.downList.forEach((row, index) => {
											this.jsonData.push({
												uuid: this.downList[index].uuid,
												userName: this.downList[index].userName,
												auxiliaries: this.downList[index].auxiliaries,
												levelId: this.downList[index].levelId?this.downList[index].levelId:'VIP',
												walletBalance: this.Fixed(
													this.downList[index].walletBalance,
													4
												),
												usdtBalance: this.Fixed(
													this.downList[index].usdtBalance,
													4
                        ),
                        oneBalance: this.Fixed(
													this.downList[index].oneBalance,
													4
												),
												twoBalance: this.Fixed(
													this.downList[index].twoBalance,
													4
                        ),
                        threeBalance: this.Fixed(
													this.downList[index].threeBalance,
													4
												),
												
												nodesNum: this.downList[index].nodesNum,
												number: this.downList[index].number,
												createTime: this.downList[index].createTime?this.downList[index].createTime:'#',
												status: this.downList[index].status == 1 ?
													"正常" :
													this.downList[index].status == 2 ?
													"冻结" :
													"#"
											});
										});
										let str = `个人UUID,用户名,助记词,等级,USDT账户(持有量),钱包账户(持有量),第一期账户,第二期账户,第三期账户,Ta的节点,团队人数,注册时间,账户状态\n`;
										this.downLoad(this.jsonData, str, "会员列表");
									}
								});
						}
					});
			},
			// // 处理时间段时间格式
			getTime(daterange) {
				this.dataValue = daterange;
			},
			getTime1(daterange) {
				this.dataValue1 = daterange;
			},
			// 获取所有会员列表
			getList() {
				this.axios
					.post(
						"/admin/account/member/getAllUser",
						this.qs.stringify({
							current: this.page,
							size: this.pageSize,
							uuid: this.userID,
							phone: this.phone,
							trueName: this.trueName,
							status: this.state2 == 0 ? "" : this.state2,
							levelId: this.state,
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + " 00:00:00",
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + " 23:59:59"
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.list = res.data.data.records;
							this.list.forEach((row, index) => {
								this.list[index].status =
									row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
							});
							this.info = res.data.data.total;
						}
						this.loading = false;
					});
			},
			// 查询
			query() {
				this.loading = true;
				let spy;
				this.current = 1;
				this.page = 1;
				this.axios
					.post(
						"/admin/account/member/getAllUser",
						this.qs.stringify({
							current: this.page,
							size: this.pageSize,
							uuid: this.userID,
							phone: this.trueName,
							status: this.state2 == 0 ? "" : this.state2,
							levelId: this.state,
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + " 00:00:00",
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + " 23:59:59"
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.list = res.data.data.records;
							this.list.forEach((row, index) => {
								this.list[index].status =
									row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
							});
							this.info = res.data.data.total;
							this.current = 1;
						} else if(res.data.code == 500) {
							this.$Message.info(res.data.msg);
							this.list = [];
							this.info = this.list.length;
						}
						this.loading = false;
					});
			},
			userStatus(id, statusId) {
				let _this = this;
				let statusText = "";

				if(statusId == "2") {
					statusText = "冻结";
				} else {
					statusText = "解冻";
				}

				this.$Modal.confirm({
					title: statusText + "账号",
					content: "是否要" + statusText + "该用户",
					onOk: function() {
						let params = this.qs.stringify({
							userId: id,
							status: statusId
						});
						_this.axios
							.post("/admin/account/member/freezeOrUnFreezeUser", params)
							.then(res => {
								if(res.data.code == 200) {
									_this.$Message.info(res.data.msg);
									_this.getList();
								} else if(res.data.code == 500) {
									_this.$Message.info(res.data.msg);
								}
							});
					}
				});
			},
			// 分页
			changepage(page) {
				this.loading = true;
				this.page = page;
				this.axios
					.post(
						"/admin/account/member/getAllUser",
						this.qs.stringify({
							current: this.page,
							size: this.pageSize,
							uuid: this.userID,
							phone: this.phone,
							trueName: this.trueName,
							status: this.state2 == 0 ? "" : this.state2,
							levelId: this.state,
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + " 00:00:00",
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + " 23:59:59"
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.list = res.data.data.records;
							this.list.forEach((row, index) => {
								this.list[index].status =
									row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
							});
						}
						this.loading = false;
					});
			},
			// 分页
			changepage2(page) {
				this.loading2 = true;
				this.page2 = page;
				this.jidian();
			},
			// 分页
			changepage3(page) {
				this.getUser(this.lsType, page);
			},
			Recharge(uuid, id, userName) {
				this.$refs["refuse"].resetFields(); // 重置表单
				this.modal1 = true;
				this.addForm.userId = uuid;
				this.addForm.id = id;
				this.addForm.userName = userName;
			},
			addjj() {
				// ok添加
				this.$refs.refuse.validate(valid => {
					// 表单验证
					if(valid) {
						if(this.addForm.accountType == "") {
							this.$Message.info("请选择充值账户");
							return false;
						}
						let params = this.qs.stringify({
							userId: this.addForm.id,
							num: this.addForm.userNum,
							remark: this.addForm.userRem,
							rechargePass: this.addForm.password,
							accountType: this.addForm.accountType
						});
						this.axios
							.post("/admin/account/member/rechargeAccount", params)
							.then(res => {
								if(res.data.code == 200) {
									this.$Message.info(res.data.msg);
									this.getList();
									this.modal1 = false;
								}
							});
					}
				});
			},
			closejj() {
				this.modal1 = false;
				this.addForm.coinId = "";
				this.addForm.accountType = "";
			},
			complaintPageChange(page) {
				this.loading5 = true;
				this.axios
					.post(
						"/admin/otc/getUserAppealedRecord",
						this.qs.stringify({
							size: this.pageSize2,
							current: page,
							userId: this.complaintId
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.complaintList = res.data.data.records;
							this.info7 = res.data.data.total;
							this.loading5 = false;
							this.complaintCount = res.data.data.total;
						}
					});
			},
			change(e) {
				this.state = e;
			},
			change3(e) {
				this.state3 = e;
			},
			teamPageChange(page) {
				this.teamLoading = true;
				this.axios
					.post(
						"/admin/account/member/getTeamList",
						this.qs.stringify({
							id: this.teamById,
							size: this.pageSize2,
							current: page
						})
					)
					.then(res => {
						if(res.data.code == 200) {
							this.teamLoading = false;
							this.teamList = res.data.data.records;
							this.teamList.teamLayer = this.teamList.layer - this.layer;
							this.teamList.forEach((row, i) => {
								this.teamList[i].teamLayer = row.layer - this.layer;
							});
						}
					});
			}
		},
		created() {
			this.getList();
		},
		mounted() {
			this.$Message.config({
				top: 250
			});

		}
	};
</script>
<style lang="less">
	.caozuo {
		.ivu-modal-wrap {
			.ivu-modal {
				.ivu-modal-content {
					.ivu-modal-footer {
						padding: 12px 18px 12px 18px;
						.ivu-btn-text {
							float: left;
							padding-left: 70%;
						}
					}
				}
			}
		}
	}
	
	.w250 {
		width: 250px !important;
	}
	
	.demo-spin-container {
		display: inline-block;
		position: relative;
	}
</style>